Skip to content

Kill hung runs early when a pinned pool model is delisted#621

Open
seonghobae wants to merge 1 commit into
mainfrom
seonghobae-pool-watchdog-model-unavailable
Open

Kill hung runs early when a pinned pool model is delisted#621
seonghobae wants to merge 1 commit into
mainfrom
seonghobae-pool-watchdog-model-unavailable

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Follow-up hardening after #619 pinned OpenRouter free models in the OpenCode review pool.

Problem

If a pinned free model is delisted, OpenRouter answers with a model-unavailable error (No endpoints found for <model>, not a valid model ID) and some provider paths then hang instead of exiting. has_fatal_provider_error_event only recognized context-window/quota signatures, so a delisted candidate would burn its full run budget before the pool fell through.

Changes (scripts/ci/run_opencode_review_model_pool.sh)

  • Watchdog: has_fatal_provider_error_event now also matches model-unavailable signatures (no endpoints, not a valid model, model_not_found / model not found, ModelNotFoundError) — still only on structured "type":"error" events, so model prose quoting these strings never kills a healthy run.
  • Retry skip: is_fatal_provider_failure matches the same signatures, so a delisted model returns the skip-remaining-attempts path instead of retrying a model that cannot recover.
  • Diagnostics: emit_sanitized_opencode_failure_detail classifies these as class=model-unavailable (metadata only, provider content stays suppressed).
  • Filename sanitization: per-candidate file names now also replace : (OpenRouter :free suffix), which Windows and actions/upload-artifact reject.

Review timing (timeouts / deadlines / context caps) is untouched.

Tests

  • New test_delisted_openrouter_model_error_kills_hung_run_early: openrouter-shaped candidate (openrouter/nvidia/nemotron-3-ultra-550b-a55b:free) with an OpenRouter-shaped No endpoints found error event; asserts the hung fake run is killed in seconds, remaining attempts are skipped, and class=model-unavailable is logged.
  • tests/test_opencode_model_pool_runner.py: 18 passed; tests/test_opencode_agent_contract.py: 34 passed (1 deselected locally: pre-existing WSL-bash hang on Windows, unrelated); shell-syntax tests + bash -n pass.

Extend the model-pool watchdog and fatal-failure classification with
model-unavailable signatures (OpenRouter 'No endpoints found' /
'not a valid model ID', OpenAI-style model_not_found,
ProviderModelNotFoundError) so a delisted pinned free model is killed
within the poll interval and skipped instead of burning the candidate
run budget. Sanitize ':' in per-candidate file names so ':free'
candidates survive Windows and actions/upload-artifact. Review timing
(timeouts, deadlines, context caps) is untouched.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 24, 2026 12:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the OpenCode model-pool runner so it can fail over quickly when a pinned OpenRouter free-tier model is delisted (model-unavailable errors), avoiding long hangs that consume the entire retry budget and delay org-wide PR governance workflows.

Changes:

  • Extend fatal-provider detection to include model-unavailable signatures (e.g., “No endpoints found”, “not a valid model”, model_not_found) and treat them as non-retryable for the current model candidate.
  • Classify these failures as class=model-unavailable in sanitized diagnostics while keeping provider-controlled content suppressed.
  • Sanitize per-candidate filenames to replace : as well as /, preventing Windows and actions/upload-artifact path issues for :free model suffixes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
scripts/ci/run_opencode_review_model_pool.sh Detects model-unavailable error events to kill hung runs early, skips futile retries for delisted models, emits model-unavailable diagnostics, and sanitizes : in candidate-derived filenames.
tests/test_opencode_model_pool_runner.py Adds a regression test ensuring an OpenRouter “No endpoints found … :free” error kills a hung run quickly, skips remaining attempts, and logs class=model-unavailable.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants